home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / FST30A.ZIP;1 / LISTS.DEF < prev    next >
Encoding:
Modula Definition  |  1992-09-19  |  1.6 KB  |  65 lines

  1. DEFINITION MODULE Lists;
  2.  
  3. (* (C) Copyright 1992 Fitted Software Tools. All rights reserved. *)
  4.  
  5. (*
  6.     This module defines the LinkedList class.
  7.  
  8.     The LikedList class provides methods to add (append) and delete
  9.     (delete) items from a linked list object and a means of
  10.     traversing that list (getfirst, getnext).
  11.  
  12.     Objects to be placed into the LinkedList must be of type
  13.     LinkedListItem.
  14. *)
  15.  
  16.  
  17. CLASS LinkedListItem;
  18. (*
  19.     We hide the structure of a LinkedListItem in the implementation,
  20.     as the user has no need to access that information.
  21. *)
  22. END LinkedListItem;
  23.  
  24.  
  25. CLASS LinkedList;
  26. (*
  27.     This class defines methods to add, delete and access items in a
  28.     linked list.
  29. *)
  30.  
  31.     PROCEDURE append( item :LinkedListItem );
  32.     (*
  33.         Append item to the list.
  34.     *)
  35.  
  36.     PROCEDURE getfirst( VAR item :LinkedListItem ) :BOOLEAN;
  37.     (*
  38.         Get the first item in the list (returned in 'item').
  39.         Return TRUE if there is an item in the list
  40.                FALSE if the list is empty.
  41.     *)
  42.  
  43.     PROCEDURE getnext( VAR item :LinkedListItem ) :BOOLEAN;
  44.     (*
  45.         Get the next item in the list -- You must call getfirst
  46.         before your first call to getnext.
  47.         Return TRUE if a 'next' was returned
  48.                FALSE if we reached the end of the list.
  49.     *)
  50.  
  51.     PROCEDURE delete( item :LinkedListItem );
  52.     (*
  53.         delete item from the list.
  54.     *)
  55.  
  56.     (*
  57.         DESTROY:
  58.             When the list is DISPOSEd, all the items in the list are
  59.             DISPOSEd too.
  60.     *)
  61.  
  62. END LinkedList;
  63.  
  64.  
  65. END Lists.